package com.example.datajdbc.model;

import java.sql.Clob;
import java.sql.SQLException;
import java.util.Map;

import lombok.Data;

@Data
public class ModelMapEntry implements Map.Entry<String, Model> {

    private final String key;

    private final Model value;

    public ModelMapEntry(final String name, final Clob description) {
        this.key = name;
        try {
            this.value = new Model(name, description.getSubString(1, (int) description.length()));
        } catch (final SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public Model setValue(final Model value) {
        throw new UnsupportedOperationException("can't set the value of a ModelMapEntry");
    }

}
